package com.example.lamdademo.lamda_test;

import com.example.lamdademo.lamdaDemo.NotReturnMultParam;
import com.example.lamdademo.lamdaDemo.ReturnMultiParam;

import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;

public class LambdaTest2 {
    public static void main(String[] args) {
        f1((i, d) -> System.out.println(i + " " + d));

        int a = 10;
        int b = 5;

        //add
        int sum = calculate((m, n) -> {
            return m + n + 1;
        }, a, b);
        System.out.println(sum);

        Runnable f3 = LambdaTest2::f3;

    }

    public static void f1(NotReturnMultParam notReturnMultParam) {
        int a = 1;
        double b = 2;
        double c = 3;
        List<Double> list = new ArrayList<>();
        list.add(b);
        list.add(c);
        list.forEach(x -> System.out.println(list.indexOf(x) + " " + x));
        notReturnMultParam.method(a, list);
    }

    public static int calculate(ReturnMultiParam returnMultiParam, int a, int b) {
        return returnMultiParam.calculate(a, b);
    }

    public static void f3() {
        System.out.println("f3()");
    }
}
